#include "ros/ros.h"
#include "std_msgs/Float64.h" 
#include <sstream>

int main(int argc, char  *argv[])
{   
    setlocale(LC_ALL,"");
    ros::init(argc,argv,"control_gazebo_demo");
    ros::NodeHandle nh;
    ros::Publisher pub = nh.advertise<std_msgs::Float64>("/gazebo_demo/joint1_position_controller/command",10);
    std_msgs::Float64 control_gazebo_demo;
    control_gazebo_demo.data=0.0;
    bool flag=0;//0weizeng 1weijian
    ros::Rate r(50);
    while (ros::ok())
    {
        
        for(control_gazebo_demo.data=0.0;control_gazebo_demo.data<=1.5;control_gazebo_demo.data+=0.01)
        {
		pub.publish(control_gazebo_demo);

		ROS_INFO("发送的消息:%f",control_gazebo_demo);
		r.sleep();
        }

        for(control_gazebo_demo.data=1.5;control_gazebo_demo.data>=0.0;control_gazebo_demo.data-=0.01)
        {
		pub.publish(control_gazebo_demo);

		ROS_INFO("发送的消息:%f",control_gazebo_demo);
		r.sleep();
        }
       

        
        ros::spinOnce();
    }
    return 0;
}
